package com.fivestar.pmanager.web.interceptor;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * 富客户端请求，重新设置到RequestContextHolder中
 *
 * @author admin
 */
public class InitializeRequestInterceptor extends HandlerInterceptorAdapter
{

    @SuppressWarnings("unused")
	private static final String XML_HTTP_REQUEST = "XMLHttpRequest";
    @SuppressWarnings("unused")
	private static final String X_REQUESTED_WITH_HEADER = "x-requested-with";
    
    
    @Override
    public boolean preHandle(HttpServletRequest request,
            HttpServletResponse response, Object handler) throws Exception
    {
        RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
        return true;
    }

}
